package com.jekun.helloworld.designmode.adapter.demo1;

/**
 * @author Administrator
 *
 * 我的播放器
 */
public class AudioPlayer implements MediaPlayer {
   MediaAdapter mediaAdapter; 
 
   @Override
   public String play(String audioType, String fileName) {
 
      //播放 mp3 音乐文件的内置支持
      if(ConstantAudioPlayer.MP3.equalsIgnoreCase(audioType)){
         return "Playing mp3 file. Name: "+ fileName;
      } 
      //mediaAdapter 提供了播放其他文件格式的支持
      else{
         mediaAdapter = new MediaAdapter(audioType);
         return mediaAdapter.play(audioType, fileName);
      }

   }   
}